package com.project.weimi.activity;

import java.util.ArrayList;
import java.util.List;

import com.project.weimi.R;
import com.project.weimi.adapter.IntegralDailyTaskAdapter;
import com.project.weimi.adapter.IntegralNewTaskAdapter;
import com.project.weimi.entity.response.IntegralDailyTaskEntity;
import com.project.weimi.entity.response.IntegralNewTaskEntity;
import com.project.weimi.utils.SetClickListener;
import com.project.weimi.view.CircleListView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class IntegralShopActivity extends BaseActivity {

	private ImageView img_integralShop;
	
	private CircleListView listView,daily_listView;
	// 新手任务列表
	private List<IntegralNewTaskEntity> list;
	// 日常任务列表
	private List<IntegralDailyTaskEntity> dailyList;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentViewWithBar(R.layout.activity_integralshop, "积分商城");

		initView();
		initNewTaskData();
		initDailyTaskData();
		
	}

	private void initView(){
		img_integralShop = (ImageView)findViewById(R.id.img_integralShop);
		listView = (CircleListView)findViewById(R.id.listView);
		daily_listView = (CircleListView)findViewById(R.id.daily_listView);
		
		// 监听
		SetClickListener.setClickListener(listener, img_integralShop);
		
	}

	// 新手任务列表数据
	private void initNewTaskData(){
		list = new ArrayList<IntegralNewTaskEntity>();
		for (int i = 0; i < 8; i++) {
			list.add(new IntegralNewTaskEntity("注册账号", "20", "10", "去完成"));
		}
		
		IntegralNewTaskAdapter adapter = new IntegralNewTaskAdapter(this, list);
		listView.setAdapter(adapter);
	}
	
	// 日常任务列表数据
	private void initDailyTaskData(){
		dailyList = new ArrayList<IntegralDailyTaskEntity>();
		for (int i = 0; i < 8; i++) {
			dailyList.add(new IntegralDailyTaskEntity("帖子被推荐", "20", "10", "0/10"));
		}
		
		IntegralDailyTaskAdapter adapter = new IntegralDailyTaskAdapter(this,dailyList);
		daily_listView.setAdapter(adapter);
	}
	
	private OnClickListener listener = new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.img_integralShop: //跳转到“积分兑换”页面
				Intent intent = new Intent(IntegralShopActivity.this,IntegralExchangeActivity.class);
				startActivity(intent);
				break;
			}
			
		}
	};
	
	@Override
	void setStatusBar(int statusBarColorRes) {
		super.setStatusBar(R.color.transparent_3);
	}

}
